﻿using System.Collections.Concurrent;

namespace Logger7;

public sealed class SqlServerLoggerProvider : ILoggerProvider
{
    private readonly SqlServerLoggerProcessor _Processor;
    private readonly ConcurrentDictionary<string, SqlServerLogger> _Loggers = new();

    public SqlServerLoggerProvider(SqlServerLoggerProcessor processor)
    {
        _Processor = processor;
    }

    public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new SqlServerLogger(categoryName, _Processor));

    public void Dispose() { }
}
